package org.lanqiao.service.impl;

import org.lanqiao.dao.RechargeRecordDao;
import org.lanqiao.entity.RechargeRecord;
import org.lanqiao.mapper.RechargeRecordMapper;
import org.lanqiao.service.RechargeService;
import org.lanqiao.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RechargeServiceImpl implements RechargeService {
    @Autowired
    private RechargeRecordDao rechargeRecordDao;
    @Override
    /**
     * @Author 刘力铭
     * @Description
     * @Date 2019/5/23 19:51
     * @Param 查询充值流水所有数据、返回码
     * @Return
     **/
    public Result queryRechargeList() {
        try {
            List<RechargeRecord> rechargeRecords = rechargeRecordDao.queryRechargeList();
            //将查出的数据传到Result 得到返回码
            return Result.ok(rechargeRecords);
        }catch (Exception e){
            return  Result .defeated("");
        }
    }

    @Override
    public Result selectByName(String wxName) {
        try{
            List<RechargeRecord> rechargeRecord = rechargeRecordDao.selectByName(wxName);
            return Result.ok(rechargeRecord);
        }catch (Exception e){
            return Result.defeated("");
        }
    }
}
